$f-filter-selected-bg: rgba($f-aid-05, 0.35) !default;
$f-filter-selected-border-color: $f-aid-05 !default;

.f-filter-footer,
.f-sort-editor {
  .footer-container {
    height: 2rem;
    min-height: 2rem;
    background-color: $f-neutral-07;
    line-height: 2rem;
    flex-shrink: 0;
  }
}

.f-list-filter {
  .filter-expand {
    color: $f-text-07;
    cursor: pointer;

    &:hover {
      color: $farris-btn-secondary-hover-color;
    }

    &.active {
      color: $f-theme-03;
      background: rgba($f-theme-05, 0.10);
    }

    .filter-expand-tag {
      background-color: $f-semantic-danger-01;
    }
  }

  .filter-search-btn-reset:hover {
    color: $farris-btn-secondary-hover-color !important;
  }
}

.f-filter {
  display: block;
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 0;
  max-width: 100%;
}

.f-filter-wrapper {
  display: flex;
  align-items: flex-start;
  position: relative;

  .f-filter-wrapper-inner {
    display: flex;
    align-items: flex-start;

    .f-filter-extend-btn {
      display: flex;
      flex-shrink: 0;
      align-items: center;
      flex-shrink: 0;
      height: 26px;
      line-height: 26px;
      padding-left: 10px;

      .extend-btn-text {
        margin-right: 2px;
      }

      .extend-btn-arrow {
        margin-left: 8px;
      }
    }

    .f-filter-extend-btn-advanced {
      flex-shrink: 0;
      width: 24px;
      height: 24px;
      margin-left: 21px;
      line-height: 24px;
      color: rgba(0, 0, 0, 0.25);
      cursor: pointer;

      &:hover {
        color: $f-theme-05;
      }

      &.active {
        box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.15);
        color: $f-theme-01;
        background: rgba(56, 143, 255, 0.1);
        border-radius: 2px;
      }

      .f-icon {
        display: block;
        line-height: 24px;
        margin: 0 auto;
        font-size: 18px;
      }

      .filter-expand-tag {
        position: absolute;
        right: 0px;
        top: 0px;
        display: block;
        width: 6px;
        height: 6px;
        background-color: #f5222d;
        border-radius: 50%;
      }
    }
  }

  .f-filter-inputs-extend {
    width: 429px;
    right: 0;
    top: 38px;
    background-color: #fff;
    box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.15);
    z-index: 101;
    padding: 20px 0;

    .f-filter-typelist-arrow {
      display: block;
      position: absolute;
      right: 7px;
      top: -4px;
      width: 8.48528137px;
      height: 8.48528137px;
      background: transparent;
      border-style: solid;
      border-width: 4.24264069px;
      border-top-color: #fff;
      border-right-color: transparent;
      border-bottom-color: transparent;
      border-left-color: #fff;
      box-shadow: -2px -2px 5px rgba(0, 0, 0, 0.08);
      transform: translateX(-50%) rotate(45deg);
    }

    .f-filter-form-btns {
      margin-top: 6px;
      padding: 0 14px;

      .btn {
        margin-left: 6px;
      }

      .filter-form-btn-reset {
        position: relative;
        padding-right: 10px;
        margin-right: 4px;

        &::after {
          content: "";
          position: absolute;
          right: 0;
          top: 50%;
          width: 1px;
          height: 16px;
          margin-top: -8px;
          background: #d9d9d9;
        }
      }
    }
  }

  .f-filter-main {
    display: flex;

    .f-filter-list-wrapper {
      max-width: 100%;
      margin-right: 26px;
      overflow: hidden;
    }
  }

  .f-filter-list {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    height: 26px;

    .f-filter-item {
      display: flex;
      align-items: center;
      flex-shrink: 0;
      position: relative;
      height: 26px;
      line-height: 26px;
      margin-right: 8px;
      padding: 0 10px 0 12px;
      font-size: 13px;
      color: rgba(0, 0, 0, 0.85);
      border: 1px solid #fff;
      border-radius: 3px;
      cursor: pointer;

      &-text {
        flex-shrink: 0;
      }

      &-content {
        margin-left: 4px;
        color: rgba(0, 0, 0, 0.85);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      &-arrow {
        flex-shrink: 0;
        margin-left: 8px;
        color: rgba(0, 0, 0, 0.45);
      }

      &:hover,
      &.f-filter-item-edit {
        background: $f-filter-selected-bg;
        border-color: $f-filter-selected-border-color;
      }

      &.f-filter-item-actived {
        background: $f-filter-selected-bg;
        border: 1px solid $f-filter-selected-border-color;
        border-radius: 3px;

        &:hover {
          .f-filter-item-clear {
            display: flex;
          }
        }
      }

      &-clear {
        display: none;
        flex-direction: column;
        justify-content: center;
        position: absolute;
        right: 2px;
        top: 0;
        bottom: 0;
        padding: 0 8px;
        cursor: pointer;

        .f-icon {
          font-size: 13px;
          color: $f-theme-08;
          background-color: $f-filter-selected-bg;
        }
      }

      &-required {
        flex-shrink: 0;
        margin-right: 2px;
      }

      &-inner {
        display: flex;
        align-items: center;
        max-width: 286px;
      }
    }

    &.f-filter-list-extend {
      height: auto;

      .f-filter-item-last {
        margin-right: 18px;
      }

      .f-filter-item {
        margin-bottom: 6px;
      }
    }
  }

  .f-filter-list-ellipsis {
    flex-shrink: 0;
    width: 48px;
    height: 26px;
    line-height: 20px;
    padding-right: 18px;
    text-align: center;
    cursor: pointer;
  }

  .f-filter-toolbars {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    padding: 3px 0 3px 0;

    .btn {
      margin-right: 18px;
    }

  }

  .f-filter-list-extend .f-filter-toolbars {
    margin-bottom: 8px;
  }

  .f-filter-item-reminder {
    position: absolute;
    top: calc(100% - 6px);
    left: 0;
    padding-top: 11px;
    z-index: 100;

    .reminder-arrow {
      position: absolute;
      top: 2px;
      left: 10%;

      &::after {
        position: absolute;
        top: 2px;
        display: block;
        content: "";
        border-color: transparent;
        border-style: solid;
        border-width: 0 6px 8px 6px;
        border-bottom-color:  $f-theme-03;
      }
    }

    .reminder-inner {
      padding: $f-filter-reminder-inner-inner-gutter;
      font-size: 13px;
      color: #fff;
      white-space: nowrap;
      background: $f-filter-reminder-bg;
      box-shadow: 2px 2px 8px 0 rgba(0, 0, 0, 0.14);
      border-radius: $f-filter-reminder-inner-border-radius;

      .f-icon {
        margin-right: 6px;
        font-size: 13px;
      }
    }
  }
}

.f-filter-panel-form .filter-type-checkboxgroup .farris-form-group .farris-input-wrap .custom-checkbox,
.f-filter-panel-form .filter-type-radio .farris-form-group .farris-input-wrap .custom-radio {
  margin-bottom: 0px;
  margin-top: 0;

  &:last-child {
    margin-bottom: 0;
  }

  .custom-control-label {
    display: block;
    width: 100%;
    line-height: 30px;

    &::before {
      top: 8px;
    }
  }

  &:hover {
    background-color: #F3F8FF;
  }
}

.f-sidebar-filter-main .f-sidebar-filter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between !important;
  height: 72px !important;
  padding: 10px 24px !important;
  border-top: 1px dashed #eaedf3 !important;
  background: #fff !important;
}

.f-sidebar-filter-main .f-sidebar-header {
  .f-tmpl-for-title-withline::before {
    display: none;
  }
}

.f-sidebar-filter-main .f-sidebar-filter-content {
  padding: 24px 48px 24px 12px !important;

  .farris-form-controls-inline .farris-group-wrap .form-group {
    margin-bottom: 10px;
  }
}

.f-sidebar-filter-main .f-sidebar-filter-btns {
  .btn {
    height: 32px;
    line-height: 28px;
    margin-right: 12px;
  }

  .f-sidebar-filter-btn-confirm {
    padding-left: 66px;
    padding-right: 66px;
    margin-right: 0;
  }
}

.f-sidebar-filter-list,
.f-filter-inputs-extend-list {
  .form-group {
    display: block;
  }

  &.farris-form-controls-inline {
    .form-group {
      display: flex;
    }
  }
}

.f-filter-panel-flexible-icon {
  flex-shrink: 0;
  margin: 0 6px;
  font-size: 14px;
  color: #999999;
}

.f-filter-panel-wrapper {
  position: fixed;
  z-index: $farris-modal-zindex;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  pointer-events: auto;
}

.f-filter-panel {
  position: absolute;
  z-index: 100;
  padding-top: 14px;

  &-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    .panel-header-title {
      line-height: 22px;
      font-size: 15px;
      color: rgba(0, 0, 0, 0.85);
      font-weight: 600;
    }
  }

  &-content {
    padding-top: 8px;

    .filter-type-checkboxgroup {
      max-height: 216px;
      padding: 6px 8px 6px 0;
      border-radius: 2px;
      overflow-y: auto;

      .custom-checkbox {
        padding-left: 14px;
      }
    }
  }

  &-footer {
    display: flex;
    justify-content: space-between;
    padding-top: 16px;
    align-items: center;

    .filter-panel-submit {
      padding-left: 22px;
      padding-right: 22px;
      margin-left: 8px;
    }

    .btn-link {
      padding-right: 8px;
    }

    .btn-empty {
      position: relative;
      padding-left: 8px;

      &::before {
        position: absolute;
        left: 0;
        top: 50%;
        width: 1px;
        height: 16px;
        margin-top: -8px;
        background-color: rgba(216, 220, 230, 0.6);
        content: '';
      }
    }
  }

  .f-filter-panel-inner {
    position: relative;
    min-width: 380px;
    padding: 14px 24px 18px;
    background-color: #fff;
    box-shadow: 0 2px 12px 0 rgba(31, 35, 41, 0.10);
    border-radius: 4px;

    &.f-filter-panel-inner-xs {
      padding: 10px 4px 16px;
    }

    &.f-filter-panel-inner-auto {
      min-width: auto;
      padding: 0;
    }
  }

  &-arrow {
    position: absolute;
    top: -12px;
    left: 26px;

    &::after {
      position: absolute;
      top: 2px;
      display: block;
      content: "";
      border-color: transparent;
      border-style: solid;
      border-width: 0 8px 10px 8px;
      border-bottom-color: #fff;
    }
  }

  &.f-filter-panel-radio .f-filter-panel-inner {
    min-width: 230px;
  }

  .f-panel-filter-tip {
    display: flex;
    align-items: center;
    margin-bottom: 12px;

    .panel-filter-tip-text {
      margin-right: 8px;
    }
  }

  .panel-flexible-range-wrapper {
    align-items: center;

    .f-icon {
      flex-shrink: 0;
      margin: 0 8px;
      font-size: 14px;
      color: #999999;
    }

    .f-cmp-number-spinner,
    .f-cmp-datepicker {
      width: 150px;
    }
  }
}

.f-filter-panel-date-tags {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-top: 12px;

  .panel-date-tag {
    height: 24px;
    line-height: 22px;
    padding: 0 14px;
    margin-right: 8px;
    font-size: 12px;
    background-color: #fff;
    border: 1px solid rgba(216, 220, 230, 0.60);
    border-radius: 13px;
    cursor: pointer;

    &.active {
      background: rgba($f-theme-03, 0.06);
      border: 1px solid rgba($f-theme-03, 0.16);
    }
  }
}

.filter-panel-checkbox {
  width: 100%;
  height: 30px;
  line-height: 30px;
  margin: 0;
  padding-right: 0;
  background: #F7F8FB;

  .custom-control-label {
    display: block;
    cursor: pointer;
    width: 100%;
  }

  .custom-control-label::before {
    top: 50%;
    transform: translateY(-50%);
  }
}

.f-filter-panel-radiogroup {
  .panel-radiogroup-item {
    display: flex;
    align-items: center;
    padding: .5rem 1.375rem;
    border: 0;
    color: rgba(0, 0, 0, .85);
    cursor: pointer;

    &.panel-radiogroup-item-active {
      background: #EEF5FF;
      border-radius: 3px;
    }

    &-text {
      font-size: 14px;
      line-height: 18px;
    }

    &:hover {
      background-color: #F3F8FF;
    }
  }
}

.f-filter-search-result-panel {
  position: absolute;
  left: 0;
  top: 26px;
  z-index: 100;
  width: 200px;
  padding: 8px;
  color: rgba(0, 0, 0, 0.85);
  background-color: #fff;
  box-shadow: 0 2px 12px 0 rgba(31, 35, 41, 0.1);
  border-radius: 4px;

  .search-result-title {
    line-height: 22px;
    font-size: 14px;
    font-weight: 600;
  }

  .search-result-list {
    .search-result-item {
      line-height: 26px;
      font-size: 14px;
      cursor: pointer;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;

      &:hover {
        background: rgba(42, 135, 255, 0.06);
      }
    }
  }
}

.f-filter-panel-search-tags {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  max-width: 320px;
  padding-top: 12px;

  .panel-search-tag {
    display: flex;
    align-items: center;
    height: 24px;
    line-height: 22px;
    margin-right: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    color: #333333;
    background-color: #fff;
    border: 1px solid rgba(216, 220, 230, 0.6);
    border-radius: 2px;
    cursor: pointer;

    &:last-child {
      margin-right: 0;
    }

    .panel-search-tag-text {
      max-width: 72px;
      padding-left: 8px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .panel-search-tag-remove {
      height: 22px;
      line-height: 22px;
      margin-left: 6px;
      margin-right: 8px;
      font-size: 14px;
      color: #999;
      cursor: pointer;
    }

    &:active {
      background: rgba(42, 135, 255, 0.06);
      border: 1px solid rgba(42, 135, 255, 0.16);
    }
  }
}

.f-filter-container {
  padding-bottom: 12px;
}